package edu.uis.project.frankszoo.model.game;

import java.util.ArrayList;
import java.util.List;

import edu.uis.project.frankszoo.model.card.Card;

/**
 * This class represents the cards that comprise the ranking set as well as cards that have been outranked within the hand.
 */
public class GameHandTable {

	List<Card> activeCardSet; // Set of cards that outrank the others and for the active animal set
	List<Card> outRankedCards; // Set of cards that are in a hand and have outranked by the activecardset
	String activeSetOwner;// Name of the player who is outranking others in the current hand

	/**
	 * This is the default constructor for the GameHandTable
	 */
	public GameHandTable() {
		this.activeCardSet = new ArrayList<Card>();
		this.outRankedCards = new ArrayList<Card>();
	}

	/**
	 * Gets the list of active cards set of this game.
	 * 
	 * @return activeCardSet Set of cards that outrank the others and for the active animal set
	 */
	public List<Card> getActiveCardSet() {
		return activeCardSet;
	}

	/**
	 * Gets the cards that are outranked by the active card set
	 * 
	 * @return outRankedCards Set of cards that are in a hand and have outranked by the activecardset
	 */
	public List<Card> getOutRankedCards() {
		return outRankedCards;
	}

	/**
	 * Gets the name of the player who is outranking others in the current hand.
	 * 
	 * @return activeSetOwner Name of the player who is outranking others in the current hand
	 */
	public String getActiveSetOwner() {
		return activeSetOwner;
	}

	/**
	 * Adds all the outranked cards to the list of the current hand Changes the active cards set to the outranked cards and player's name as
	 * outranking player's name of this hand.
	 * 
	 * @param outrankCards
	 *            Set of cards that are in a hand and have outranked by the activecardset
	 * @param outrankingPlayer
	 *            Name of the player who is outranking others in the current hand
	 */
	public void outRank(List<Card> outrankCards, String outrankingPlayer) {
		this.outRankedCards.addAll(activeCardSet);
		this.activeCardSet = outrankCards;
		this.activeSetOwner = outrankingPlayer;
	}

	/**
	 * Resets the GameTable. This is invoked at the end of a Hand
	 */
	public void purgeGameTable() {
		this.activeCardSet = new ArrayList<Card>();
		this.outRankedCards = new ArrayList<Card>();
		activeSetOwner = "";
	}
}
